package com.dimples.dd.system.convert;

import com.dimples.dd.common.model.Option;
import com.dimples.dd.common.pojo.PageResult;
import com.dimples.dd.system.framework.sms.core.property.SmsChannelProperties;
import com.dimples.dd.system.model.entity.SystemSmsChannelDO;
import com.dimples.dd.system.model.form.SmsChannelForm;
import com.dimples.dd.system.model.vo.SmsChannelPageVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @author zhongyj <1126834403@qq.com><br/>
 * @date 2024/10/28
 */
@Mapper(componentModel = "spring")
public interface SmsChannelConvert {
    SystemSmsChannelDO form2Entity(SmsChannelForm createSmsChannelForm);

    SmsChannelProperties entity2Properties(SystemSmsChannelDO channel);

    SmsChannelForm entity2Form(SystemSmsChannelDO systemSmsChannelDO);

    PageResult<SmsChannelPageVO> entity2Page(PageResult<SystemSmsChannelDO> pageResult);

    SmsChannelPageVO entity2Vo(SystemSmsChannelDO systemSmsChannelDO);

    List<Option<Long>> entity2Options(List<SystemSmsChannelDO> systemSmsChannelDOS);

    @Mappings({
            @Mapping(target = "value", source = "id"),
            @Mapping(target = "label", source = "code"),
            @Mapping(target = "extra", source = "signature")
    })
    Option<Long> entity2Option(SystemSmsChannelDO systemSmsChannelDO);
}

